import tushare as ts
ts.set_token('d67b0d40ccabf543ac962d2987d124588ae6fa5d2041e70fc8c93beb')

api = ts.pro_api()

symbol = '300750.SZ'  # 股票代码
startdate = '20220201'  # 起始日期
enddate = '20220228'  # 结束日期

data = api.daily(ts_code=symbol, start_date=startdate, end_date=enddate)

# 将交易日按上中下旬分组
first_ten_days= data[:10]
second_ten_days= data[10:20]
third_ten_days= data[20:28]

print("上旬前3个交易日的收盘价：")
print(first_ten_days['close'][:3])
print("中旬前3个交易日的收盘价：")
print(second_ten_days['close'][:3])
print("下旬前3个交易日的收盘价：")
print(third_ten_days['close'][:3])
